﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TinyERP.ERP.Entity;
using TinyERP.ERP.DTO;

namespace TinyERP.ERP.Business
{
    public class ContactService
    {
        public IMContactDTO ConvertIMContactBO(IMContact imBO)
        {
            IMContactDTO imDTO = new IMContactDTO();
            imDTO.ID = imBO.ID;
            imDTO.OnlineService = imBO.OnlineService;
            imDTO.IsPrimaryAccount = imBO.IsPrimaryAccount;
            imDTO.Account = imBO.Account;
            return imDTO;
        }

        public IMContact ConvertIMContactDTO(IMContactDTO imDTO)
        {
            IMContact imBO = new IMContact();
            imBO.ID = imDTO.ID;
            imBO.OnlineService = imDTO.OnlineService;
            imBO.IsPrimaryAccount = imDTO.IsPrimaryAccount;
            imBO.Account = imDTO.Account;
            return imBO;
        }
        public PhoneNumberDTO ConvertPhoneNumberBO(PhoneNumber phoneNumberBO)
        {
            PhoneNumberDTO phoneDTO = new PhoneNumberDTO();
            phoneDTO.Extension = phoneNumberBO.Extension;
            phoneDTO.ID = phoneNumberBO.ID;
            phoneDTO.PhoneTypeEnumValue = phoneNumberBO.PhoneNumberType;
            phoneDTO.PhoneNumber = phoneNumberBO.Number;
            phoneDTO.IsPrimaryPhoneNumber = phoneNumberBO.IsPrimaryPhoneNumber;
            return phoneDTO;
        }

        public PhoneNumber ConvertPhoneNumberDTO(PhoneNumberDTO phoneNumberDTO)
        {
            PhoneNumber phoneBO = new PhoneNumber();
            phoneBO.Extension = phoneNumberDTO.Extension;
            phoneBO.ID = phoneNumberDTO.ID;
            phoneBO.PhoneNumberType = phoneNumberDTO.PhoneTypeEnumValue;
            phoneBO.Number = phoneNumberDTO.PhoneNumber;
            phoneBO.IsPrimaryPhoneNumber = phoneNumberDTO.IsPrimaryPhoneNumber;
            return phoneBO;
        }

        public AddressDTO ConvertAddressBO(Address addressBO)
        {
            AddressDTO addressDTO = new AddressDTO();
            addressDTO.ID = addressBO.ID;
            addressDTO.City = addressBO.City;
            addressDTO.Country = addressBO.Country;
            addressDTO.StreetAddress = addressBO.StreetAddress;
            addressDTO.IsMainAddress = addressBO.IsMainAddress;
            return addressDTO;
        }

        public Address ConvertAddressDTO(AddressDTO addressDTO)
        {
            Address addressBO = new Address();
            addressBO.ID = addressDTO.ID;
            addressBO.City = addressDTO.City;
            addressBO.Country = addressDTO.Country;
            addressBO.StreetAddress = addressDTO.StreetAddress;
            addressBO.IsMainAddress = addressDTO.IsMainAddress;
            return addressBO;
        }
    }
}
